package travianBot;

public class ResourceCounter {
	int capacity=0;
	int current=0;
	int remainingPercentage=0;
	String resourceName;
	int    originalCurrent;
	int    originalCapacity;
	
	public ResourceCounter(){};
	
	public ResourceCounter( int current, int capacity) {
		super();		
		this.capacity = capacity;
		this.originalCapacity = capacity;
		this.current = current;
		this.originalCurrent = current;
		this.remainingPercentage = 100 - (int)(100 * ((float)current/(float)capacity));
	}
	
	public ResourceCounter(String resourceName, int current, int capacity) {
		this(current, capacity);
		this.resourceName = resourceName;
	}
	

	public float getRemainingPercentage() {
		return remainingPercentage;
	}
	
	public String toString(){
		return current+"/"+this.capacity+"("+this.remainingPercentage+")";
	}
	
	public String getCSV(){
		String currentString=""+current;
		return current+","+capacity+","+remainingPercentage;
	}

	public int getCapacity() {
		return capacity;
	}

	public void setCapacity(int capacity) {
		this.capacity = capacity;
	}

	public int getCurrent() {
		return current;
	}

	public void setCurrent(int current) {
		this.remainingPercentage = 100 - (int)(100 * ((float)current/(float)capacity));
		this.current = current;
	}
	
	public String getResourceName() {
		return resourceName;
	}

	public void setResourceName(String resourceName) {
		this.resourceName = resourceName;
	}

	public int getOriginalCurrent() {
		return originalCurrent;
	}

	public int getOriginalCapacity() {
		return originalCapacity;
	}
}
